<?
	$month = @$username['month'] == FALSE ? '' : @$username['month'];
	$day = @$username['day'] == FALSE ? '' : @$username['day'];
	$year = @$username['year'] == FALSE ? '' : @$username['year'];
	$lastname = @$lastname == FALSE ? '' : @$lastname;
?>
<div id="login-container">
<ul class="nav nav-tabs" id="tab-navs">
  <li class="active"><a href="#student" data-toggle="tab">Student Login</a></li>
  <li><a href="#parent" data-toggle="tab">Parent Login</a></li>
</ul>
<?=$system_message?>
<div class="tab-content">
	<div class="tab-pane active" id="student">
		<form action="<?=site_url('auth/login');?>" class="form-horizontal" method="POST">
		<fieldset>
			<legend>Student Login</legend>
			<div class="form-group">
				<label for="inputEmail" class="col-lg-2 control-label">Birth Day</label>
				<div class="col-lg-10">
					<div class="row">
							<div class="col-md-6">
								<?=form_dropdown('username[month]', $months,set_value('username[month]',@$month),'class="form-control"');?>
							</div>
							<div class="col-md-3">
								<input type="text" class="form-control" value="<?=set_value('username[day]',@$day);?>" name="username[day]" placeholder="DAY" maxlength="2" required>
							</div>
							<div class="col-md-3">
								<input type="text" class="form-control" value="<?=set_value('username[year]',@$year);?>" name="username[year]" placeholder="YEAR" maxlength="4" required>
							</div>
						</div>
				</div>
			</div>
			<div class="form-group">
				<label for="inputPassword" class="col-lg-2 control-label">Lastname</label>
				<div class="col-lg-10">
					<input type="text" name="lastname" class="form-control" value="<?=set_value('lastname',@$lastname);?>" placeholder="Lastname"  required>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail" class="col-lg-2 control-label">Password</label>
				<div class="col-lg-10">
					<input type="password" name="studentpassword" class="form-control" id="inputPassword" placeholder="Password">
				</div>
			</div>
			<div class="form-group">
				<label for="textArea" class="col-lg-2 control-label">Captcha Verification</label>
				<div class="col-lg-6">
					<div class="input-group input-group-lg">
					  <input type="text" name="captcha_text" class="form-control"  maxlength="8" placeholder="CAPTCHA Code" required>
					  <span style="padding:0;" class="input-group-addon"><?=$captcha_image;?></span>
					</div>
				</div>
				<div class="col-lg-4">
						<div style="float:right;" >
						  <p><a tabindex="-1" class="confirm" href="<?=site_url('auth/forgot_password/parent')?>">Forgot Password?</a></p>
						</div>
				</div>
			</div>
			<div class="form-group">
				<div class="col-lg-10 col-lg-offset-2">
					<input type="hidden" name="form_input_token" value="<?=$form_token;?>">
					<input type="submit" value="Login" name="login_student" class="btn btn-primary">
					<input type="reset" value="Clear All" class="btn btn-default">
				</div>
			</div>
		</fieldset>
		</form>
	</div>
	<div class="tab-pane" id="parent">
		<form action="<?=site_url('auth/login');?>" method="POST" class="form-horizontal" autocomplete="off">
			<fieldset>
			<legend>Parent Login</legend>
				<div class="form-group">
					<?=form_error('parent_username');?>
					<label for="inputEmail" class="col-lg-2 control-label">Username</label>
					<div class="col-lg-10">
						<input type="text" class="form-control" name="parent_username" id="inputEmail" placeholder="Username">
					</div>
				</div>
				<div class="form-group">
					<?=form_error('parent_password');?>
					<label for="inputEmail" class="col-lg-2 control-label">Password</label>
					<div class="col-lg-10">
						<input type="password" class="form-control" name="parent_password" id="inputPassword" placeholder="Password">
					</div>
				</div>
				<div class="form-group">
					<?=form_error('captcha_text');?>
					<label for="textArea" class="col-lg-2 control-label">Captcha Verification</label>

					<div class="col-lg-6">
						<div class="input-group input-group-lg">
						  <input type="text" name="captcha_text" class="form-control"  maxlength="8" placeholder="CAPTCHA Code" required>
						  <span style="padding:0;" class="input-group-addon"><?=$captcha_image;?></span>
						</div>
					</div>
					<div class="col-lg-4">
						<div style="float:right;" >
						  <p><a tabindex="-1" class="confirm" href="<?=site_url('auth/forgot_password/parent')?>">Forgot Password?</a></p>
						</div>
					</div>
				</div>
				<div class="form-group">
					<div class="col-lg-10 col-lg-offset-2">
					<input type="hidden" name="form_input_token" value="<?=$form_token;?>">
					<input type="submit" name="login_parent"class="btn btn-primary" name="Login Parent">
					</div>
				</div>
			</fieldset>
		</form>
	</div>
</div>
</div>
<script>
$(document).ready(function(){
  $('#tab-navs a').click(function (e) {
        e.preventDefault();
        $(this).tab('show');
    });

    // store the currently selected tab in the hash value
    $("ul.nav-tabs > li > a").on("shown.bs.tab", function (e) {
        var id = $(e.target).attr("href").substr(1);
        window.location.hash = id;
    });

    // on load of the page: switch to the currently selected tab
    var hash = window.location.hash;
    $('#tab-navs a[href="' + hash + '"]').tab('show');
});
</script>